<?php
require_once 'entity/Runner.php';
require_once 'tools/db/DbUtils.php';
class Team{
	public $id;
	public $dossard;
	public $runner1;
	public $runner2;
	
	function Team($runner1,$runner2,$dossard){
		$this->dossard=$dossard;
		$this->runner1=$runner1;
		$this->runner2=$runner2;
	}
	
	function persist($dbutils){
		$idRunner1=$this->runner1->persist($dbutils);
		$idRunner2=$this->runner2->persist($dbutils);
		
		$dbutils->saveTeam($idRunner1,$idRunner2,$this->dossard);
		$this->id=$dbutils->getLastId();
		return $this->id;
	}
}